<?php
//view all topics in a forum

App::import('Model', 'Member');
$member = new Member();
?>
<h1><?=$topics[0]['Forum']['title']?> Forum</h1>
<table>
<tr><th>Topic</th><th>&nbsp;</th></tr>
<?php 
	foreach($topics as $topic) {
		$m = $member->findByMemberId($topic['Comment'][0]['member_id']);
		$recent = $topic['Comment'][count($topic['Comment'])-1];
		$u = $member->findByMemberId($recent['member_id']);
		echo '<tr><td>', $html->link($topic['Topic']['title'], '/topics/view/' . $topic['Topic']['id']), '<p>created by: ', $m['Member']['username'], ' ', $time->relativeTime($topic['Topic']['created']), '</p></td><td><p>most recent post by ', $u['Member']['username'], '</p><p>' , $time->relativeTime($recent['created']), "</p></td></tr>\n";

	} ?>
</table>
<?php
	pr($topics);
?>